package com.flea.hclv.controller;

import com.flea.hclv.service.HPartnershipService;
import com.flea.hclv.util.ServerResponse;
import com.flea.system.entity.OrgDept;
import com.flea.system.platform.session.FleaOrgUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: project
 * @description: 组团社与供应商的合作关系
 * @author: shiliqiang
 * @create: 2018-11-02 19:18
 * @version: 1.0
 */
@Controller
@RequestMapping("/flea/hclv/partnership/")
public class HPartnershipController {
    @Autowired
    private HPartnershipService hPartnershipService;

    /**
     * 发送建立合作关系请求
     * @param request request
     * @return 字符串
     */
    @RequestMapping("save")
    private ServerResponse<String> save(HttpServletRequest request, String receiveId){
        //receiveId 是供应商ID
        String userId = FleaOrgUtils.getCurUserUuid(request);
        OrgDept currentUserDept = FleaOrgUtils.getCurrentUserDept(userId);
        return hPartnershipService.save(userId,currentUserDept,receiveId);
    }

    //

    /**
     *
     * @param request request
     * @param partnershipId 合作关系表ID
     * @param status  状态
     * @return 字符串
     */
    @RequestMapping("update_status")
    private ServerResponse<String> updateStatus(HttpServletRequest request,String partnershipId, String status){
        String userId = FleaOrgUtils.getCurUserUuid(request);
        return hPartnershipService.updateStatus(userId,partnershipId,status);
    }
}
